import axios from "axios";
// import { tansParams } from "./index";


// 创建axios实例
export const service = axios.create({
	// baseURL: "https://api.vvhan.com/api/",
	baseURL: "/vvhan/",
	// 超时
	timeout: 10000 * 20,
});

// request拦截器
service.interceptors.request.use(
	// eslint-disable-next-line @typescript-eslint/no-explicit-any
	(config: any) => {
		// get请求映射params参数
		// if (config.method === "get" && config.params) {
		// 	let url = config.url + "?" + tansParams(config.params);
		// 	url = url.slice(0, -1);
		// 	config.params = {};
		// 	config.url = url;
		// }
		return config;
	},
	(error) => {
		console.log(error);
		Promise.reject(error);
	}
);

// 响应拦截器
// eslint-disable-next-line @typescript-eslint/no-explicit-any
service.interceptors.response.use((res: any) => {
  return res;
})

export default service;
